/**
 *    Copyright 2009-2016 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.ccb.testcenter.configuration;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ccb.testcenter.config.entity.BeanConfig;
import com.ccb.testcenter.config.entity.ConstantConfig;
import com.ccb.testcenter.config.entity.CustomRuleConfig;
import com.ccb.testcenter.config.entity.FilterConfig;
import com.ccb.testcenter.config.entity.MappingConfig;
import com.ccb.testcenter.config.entity.SegmentConfig;
import com.ccb.testcenter.servicemaping.CustomRule;
import com.ccb.testcenter.servicemaping.IFilter;
import com.ccb.testcenter.servicemaping.IRouter;
import com.ccb.testcenter.servicemaping.Mapping;
import com.ccb.testcenter.servicemaping.Segment;
import com.ccb.testcenter.servicemaping.Trcd;

/**
 * @author Clinton Begin
 */
public class Configuration {
	protected final Map<String, BeanConfig> beanConfigMap = new HashMap<>();
	protected final Map<String, ConstantConfig> constantConfigMap = new HashMap<>();
	protected final Map<String, FilterConfig> filterConfigMap = new HashMap<>();
	protected final Map<String, SegmentConfig> segmentConfigMap = new HashMap<>();
	protected final Map<String, List<SegmentConfig>> segmentConfigGroupMap = new HashMap<>();
	protected final Map<String, MappingConfig> mappingConfigMap = new HashMap<>();
	protected final Map<String, CustomRuleConfig> customRuleConfigMap = new HashMap<>();
	
	protected final Map<String, IRouter> iRouterMap = new HashMap<>();
	protected final Map<String, IFilter> iFilterMap = new HashMap<>();
	protected final Map<String, Segment> segmentMap = new HashMap<>();
//	protected final Map<String, List<SegmentConfig>> segmentGroupMap = new HashMap<>();
	protected final Map<Trcd, Mapping> iMappingMap = new HashMap<>();
	protected final Map<String, CustomRule> customRuleMap = new HashMap<>();

	
	
    
	//protected final Map<String, Router> routerImplMap = new HashMap<>();
	
	public void addBeanConfig(String name,BeanConfig beanConfig){
		this.beanConfigMap.put(name, beanConfig);
	}
	public BeanConfig get(String beanName){
		return this.beanConfigMap.get(beanName);
	}
	
	public void addConstantConfig(String name,ConstantConfig constantConfig){
		this.constantConfigMap.put(name, constantConfig);
	}
	public ConstantConfig getConstantConfig(String name){
		return this.constantConfigMap.get(name);
	}
	
	public void addFilterConfig(String id,FilterConfig filter){
		this.filterConfigMap.put(id, filter);
	}
	public FilterConfig getFilterConfig(String id){
		return	filterConfigMap.get(id);
	}
	
	public void addIRouter(String id,IRouter router){
		this.iRouterMap.put(id, router);
	}
	
	public IRouter getIRouter(String id){
		return 	this.iRouterMap.get(id);
	}
	
	public void addFilter(String id,IFilter ifilter){
		this.iFilterMap.put(id, ifilter);
	}
	public IFilter getIFilter(String id){
		return this.iFilterMap.get(id);
	}
	
	public void addCustomRule(String id,CustomRule customRule){
		this.customRuleMap.put(id, customRule);
	}
	
	public CustomRule getCustomRule(String id){
		return customRuleMap.get(id);
	}
	
	public void addSegment(String name,Segment segment){
		segmentMap.put(name, segment);
	}
	
	public Segment getSegment(String name){
		return segmentMap.get(name);
	}
	
	public void addMapping(Trcd trcd,Mapping mapping){
		this.iMappingMap.put(trcd, mapping);
	}
	
	public Mapping getMapping(Trcd trcd){
		return this.iMappingMap.get(trcd);
	}
	

}
